import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import mainRoutes from "./mainRoutes";
// import {AppRouteRecordRaw} from '@/type/data'
const Login = () => import('@/view/Login/login.vue')

interface RouteMeta {
  name?: string;
  icon?: string;
  requiresAuth?: boolean;
}
interface ChildRoute {
  path: string;
  name: string;
  component: any;
  meta?: RouteMeta;
}
export interface Route {
  path: string;
  name?: string;
  component: any;
  redirect?: string | object,
  children?: ChildRoute[];
  meta?: RouteMeta;
}
type RouteRecord = RouteRecordRaw & { meta?: RouteMeta };


//定义路由，每个路由都需要映射到一个组件。
const routes: Array<Route>  = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: [...routes, ...mainRoutes] as RouteRecord[]
})
export default router;
